<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">studentId</label>
        <div class="layui-input-block">
            <input type="text" name="studentId" lay-verify="required" lay-reqtext="studentId不能为空" placeholder="请输入studentId" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentName</label>
        <div class="layui-input-block">
            <input type="text" name="studentName" lay-verify="required" lay-reqtext="studentName不能为空" placeholder="请输入studentName" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentGender</label>
        <div class="layui-input-block">
            <input type="text" name="studentGender" lay-verify="required" lay-reqtext="studentGender不能为空" placeholder="请输入studentGender" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentBirth</label>
        <div class="layui-input-block">
            <input type="text" name="studentBirth" lay-verify="required" lay-reqtext="studentBirth不能为空" placeholder="请输入studentBirth" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentTel</label>
        <div class="layui-input-block">
            <input type="text" name="studentTel" lay-verify="required" lay-reqtext="studentTel不能为空" placeholder="请输入studentTel" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentWechat</label>
        <div class="layui-input-block">
            <input type="text" name="studentWechat" lay-verify="required" lay-reqtext="studentWechat不能为空" placeholder="请输入studentWechat" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentQq</label>
        <div class="layui-input-block">
            <input type="text" name="studentQq" lay-verify="required" lay-reqtext="studentQq不能为空" placeholder="请输入studentQq" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentUniversity</label>
        <div class="layui-input-block">
            <input type="text" name="studentUniversity" lay-verify="required" lay-reqtext="studentUniversity不能为空" placeholder="请输入studentUniversity" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentMajor</label>
        <div class="layui-input-block">
            <input type="text" name="studentMajor" lay-verify="required" lay-reqtext="studentMajor不能为空" placeholder="请输入studentMajor" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentGraduationTiem</label>
        <div class="layui-input-block">
            <input type="text" name="studentGraduationTiem" lay-verify="required" lay-reqtext="studentGraduationTiem不能为空" placeholder="请输入studentGraduationTiem" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentTechnology</label>
        <div class="layui-input-block">
            <input type="text" name="studentTechnology" lay-verify="required" lay-reqtext="studentTechnology不能为空" placeholder="请输入studentTechnology" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studentIsAccommodation</label>
        <div class="layui-input-block">
            <input type="text" name="studentIsAccommodation" lay-verify="required" lay-reqtext="studentIsAccommodation不能为空" placeholder="请输入studentIsAccommodation" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">accommodationNo</label>
        <div class="layui-input-block">
            <input type="text" name="accommodationNo" lay-verify="required" lay-reqtext="accommodationNo不能为空" placeholder="请输入accommodationNo" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">admissionDate</label>
        <div class="layui-input-block">
            <input type="text" name="admissionDate" lay-verify="required" lay-reqtext="admissionDate不能为空" placeholder="请输入admissionDate" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">providedComputer</label>
        <div class="layui-input-block">
            <input type="text" name="providedComputer" lay-verify="required" lay-reqtext="providedComputer不能为空" placeholder="请输入providedComputer" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">consultantId</label>
        <div class="layui-input-block">
            <input type="text" name="consultantId" lay-verify="required" lay-reqtext="consultantId不能为空" placeholder="请输入consultantId" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">sourceDescription</label>
        <div class="layui-input-block">
            <input type="text" name="sourceDescription" lay-verify="required" lay-reqtext="sourceDescription不能为空" placeholder="请输入sourceDescription" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studyDirection</label>
        <div class="layui-input-block">
            <input type="text" name="studyDirection" lay-verify="required" lay-reqtext="studyDirection不能为空" placeholder="请输入studyDirection" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">linkMan</label>
        <div class="layui-input-block">
            <input type="text" name="linkMan" lay-verify="required" lay-reqtext="linkMan不能为空" placeholder="请输入linkMan" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">studyMotivation</label>
        <div class="layui-input-block">
            <input type="text" name="studyMotivation" lay-verify="required" lay-reqtext="studyMotivation不能为空" placeholder="请输入studyMotivation" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">costSource</label>
        <div class="layui-input-block">
            <input type="text" name="costSource" lay-verify="required" lay-reqtext="costSource不能为空" placeholder="请输入costSource" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">idcard</label>
        <div class="layui-input-block">
            <input type="text" name="idcard" lay-verify="required" lay-reqtext="idcard不能为空" placeholder="请输入idcard" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">classId</label>
        <div class="layui-input-block">
            <input type="text" name="classId" lay-verify="required" lay-reqtext="classId不能为空" placeholder="请输入classId" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">remark</label>
        <div class="layui-input-block">
            <input type="text" name="remark" lay-verify="required" lay-reqtext="remark不能为空" placeholder="请输入remark" value="" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.ajax({
                type:"POST",
                url:"/studentInfo/insert",
                data:data.field, 
                success:function(res){
                    if(res.code==200){
                        var index = layer.alert("添加成功", {
                            title: '提示'
                        }, function () {

                            // 关闭弹出层
                            layer.close(index);

                            var iframeIndex = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(iframeIndex);

                        });
                    }else if(res.code==501){
                        var index = layer.alert("重复");
                    }else{
                        var index = layer.alert("添加失败");
                    }
                }
            });
            

            return false;
        });

    });
</script>
</body>
</html>